package com.tsky.system.entity;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 
 * @function：角色
 * @author: cainiao
 * @version 1.0 
 * @time: 2011-12-15 上午10:22:02
 */
@Entity
@Table(name = "t_SYS_ROLE")
public class Role {

	@Id
	private String id;
	private String name;
	@Column(unique = true)
	private String code;
	private String status = "1";
	private Timestamp createTime;

	private String description;

	/* realatioship */
	@OneToMany(mappedBy="role")
	private Set<User> users;
	
	@ManyToMany
	@JoinTable(name="t_SYS_ROLEMENU", joinColumns={@JoinColumn(name="ROLEID")},   
			  inverseJoinColumns={@JoinColumn(name="MENUID")})  
	private Set<Menu> menus;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	public Set<Menu> getMenus() {
		return menus;
	}

	public void setMenus(Set<Menu> menus) {
		this.menus = menus;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

}
